package cth.tda367.beavers.glossaryGame.model;

public class NormalScoreHandler {
	
	private double [] pointList;
	private int pos = 0;
	
	public NormalScoreHandler () {
		
	}
	
	public double getScore(int i) {
		return pointList[i];
	}
	public void clearHandl() {
		
	}
	
	public void setPos(int pos) {
		this.pos = pos;
	}
	public void fixPos () {
		if(pos > 0) {
			pos = 0;
		}
		else {
			pos = pointList.length-1;
		}
	}
	
	public void add(double score) {
		try {
			pointList[pos] = pointList[pos] + score;
		}
		catch(IndexOutOfBoundsException e) {
			fixPos();
			
		}
	}
	public void clearList() {
		for(int i =0; i <pointList.length; i++){
			pointList[i]=0;
		}
	}
	
	
	public void setListSize (int size) {
		pointList = new double[size];
	}
	
	
	public void setScore(double score) {
		pointList[pos] = score;
		
	}
	public double sumScore() {
		double totalScore = 0; 
		
		for(Double d : pointList) {
			totalScore += d;
		}
		
		return totalScore;
	}
	
	public void remove(double minusScore) {
		
			pointList[pos] = pointList[pos] - minusScore;
	
		
	}

}
